package com.jiezheng.huinong.action;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.jiezheng.huinong.dao.ApplyManageDAOImpl;
import com.jiezheng.huinong.model.ApplyIndexPrint;
import com.jiezheng.huinong.model.OperationStatus;
import com.jiezheng.huinong.model.PaymentVouchers;
import com.opensymphony.xwork2.ActionSupport;

/**
 * 打印通过审核的申请
 * 
 * @author QuPeng
 *
 */
public class PrintApplyAction extends ActionSupport {

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 1L;
	
	private String applyNos = "";
	
	private List<ApplyIndexPrint> applyIndexes = new ArrayList<ApplyIndexPrint>();
	
	private List<PaymentVouchers> paymentVouchers = new ArrayList<PaymentVouchers>();
	
	public String auditApplyInfo() {
		if (applyNos.isEmpty()) {
			return ERROR;
		}
		
		List<String> applyNoList = Arrays.asList(applyNos.split(":"));
		applyIndexes = (new ApplyManageDAOImpl()).getApplyIndexInfo(OperationStatus.FINAL_AUDITED, applyNoList);
		return SUCCESS;
	}
	
	public String paymentVouchersInfo() {
		if (applyNos.isEmpty()) {
			return ERROR;
		}
		
		List<String> applyNoList = Arrays.asList(applyNos.split(":"));
		paymentVouchers = (new ApplyManageDAOImpl()).getPaymentVouchers(OperationStatus.FINAL_AUDITED, applyNoList);
		return SUCCESS;
	}
	
	public String getApplyNos() {
		return applyNos;
	}

	public void setApplyNos(String applyNos) {
		this.applyNos = applyNos;
	}

	public List<ApplyIndexPrint> getApplyIndexes() {
		return applyIndexes;
	}
	
	public void setApplyIndexes(List<ApplyIndexPrint> applyIndexes) {
		this.applyIndexes = applyIndexes;
	}

	public List<PaymentVouchers> getPaymentVouchers() {
		return paymentVouchers;
	}

	public void setPaymentVouchers(List<PaymentVouchers> paymentVouchers) {
		this.paymentVouchers = paymentVouchers;
	}
	
}
